package com.sx.zongzhi.presenter;

import android.content.Context;

import com.sx.zongzhi.bean.NewSocietyOrganizationBean;
import com.sx.zongzhi.modle.ApiManager;
import com.sx.zongzhi.modle.HeadParamBean;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.NewSocietyOrganizationDetailView;

import java.util.Map;

/**新社会 详情 删除
 * Created by admin on 2017/12/9.
 */

public class NewSocietyOrganizationDetailPest {
    private NewSocietyOrganizationDetailView newSocietyOrganizationDetailView;

    public NewSocietyOrganizationDetailPest(NewSocietyOrganizationDetailView newSocietyOrganizationDetailView) {
        this.newSocietyOrganizationDetailView = newSocietyOrganizationDetailView;
    }

    public void getNewSocietyOrganizationDetail(Context context, String id){
        Map<String,Object> map = HeadParamBean.getHead(context);
        map.put("id",id);
        new ApiManager().getNewSocietyOrganizationDetail(map, new BaseCallBack<BaseResult<NewSocietyOrganizationBean>>() {
            @Override
            public void onSuccess(BaseResult<NewSocietyOrganizationBean> response) {
                newSocietyOrganizationDetailView.getNewSocietyOrganizationDetailSuccess(response.data);
            }
            @Override
            public void onFailures(String message) {
                newSocietyOrganizationDetailView.showError(message);
            }
        });
    }

    public void deleteNewSocietyOrganization(Context context,String id){
        Map<String,Object> map = HeadParamBean.getHead(context);
        map.put("id",id);
        new ApiManager().deleteNewSocietyOrganization(map, new BaseCallBack<BaseResult<Boolean>>() {
            @Override
            public void onSuccess(BaseResult<Boolean> response) {
                newSocietyOrganizationDetailView.deleteNewSocietyOrganizationSuccess(response.data);
            }
            @Override
            public void onFailures(String message) {
                newSocietyOrganizationDetailView.showError(message);
            }
        });
    }
}
